package com.cy.ppj.service.bankma.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cy.ppj.dao.mapper.bankma.BankmaCustomerMapper;
import com.cy.ppj.model.PageBean;
import com.cy.ppj.model.domian.bankma.BankmaCustomer;
import com.cy.ppj.model.query.bankma.BankmaCustomerListAdminQuery;
import com.cy.ppj.model.vo.admin.bank.BankmaCustomerListAdminVO;
import com.cy.ppj.service.BaseService;
import com.cy.ppj.service.bankma.BankmaCustomerService;


/**
 * BankmaCustomerService
 *
 * @author tanyilin
 *
 * @create 2018年12月28日 上午11:21:35
 */
@Service
public class BankmaCustomerServiceImpl extends BaseService implements BankmaCustomerService {

	@Autowired
	private BankmaCustomerMapper bankmaCustomerMapper;

	@Override
	@Transactional
	public void addBankmaCustomer(BankmaCustomer bankmaCustomer) {
		Date time = new Date();
		bankmaCustomer.setCreateTime(time);
		bankmaCustomer.setUpdateTime(time);
		bankmaCustomerMapper.insertSelective(bankmaCustomer);
	}

	@Override
	public PageBean<BankmaCustomerListAdminVO> selectBankmaCustomerListAdmin(BankmaCustomerListAdminQuery query) {
		int total = bankmaCustomerMapper.selectBankmaCustomerListAdminCount(query);
		List<BankmaCustomerListAdminVO> list = new ArrayList<>();
		if(total > 0) {
			query.startPage();
			list = bankmaCustomerMapper.selectBankmaCustomerListAdmin(query);
		}
		return new PageBean<>(list, total);
	}
	
	
}
